<%-- 
    Document   : home
    Created on : Apr 8, 2011, 6:56:35 PM
    Author     : user
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="java.util.Collections"%>
<%@page import="java.util.ArrayList"%>
<%@page import="org.apache.jasper.tagplugins.jstl.core.ForEach"%>
<%@page import="java.io.IOException"%>
<%@page import="java.io.File"%>
<%@ page import="bean.CategorySubCategoryBean"%>
<%@ page import="bean.UserBean"%>
<%@ page import="bean.FriendBean"%>
<%@ page import="database.DataManager"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">

<%
            String name = (String) session.getAttribute("name");
            String userName = (String) session.getAttribute("username");
            database.DataManager dataManager = new DataManager();

            ArrayList<CategorySubCategoryBean> categories = null;
            ArrayList<UserBean> usersData = null;
            ArrayList<FriendBean> friend = null;
            categories = dataManager.getAllCategory();
            usersData = dataManager.getAllUserData();
            friend = dataManager.getAllFriendsFromUser(userName);
%>
<html>
    <head>
        <script type="text/javascript"  src="script/ajax.js"></script>
        <script type="text/javascript" src="tabber/tabber.js"></script>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link rel="stylesheet" type="text/css" href="style1.css" MEDIA="screen"/>
        <title>JSP Page</title>
    </head>
    <body class="page">
        <%@ include file="layout/header.jsp" %>
        <div class="content">
            <div class="contentkiri tabber" id="tabber-kiri">
                <div class="tabbertab">
                    <h2>Home</h2>
                    <form name="home" action="database?query=perintah&id=<%=userName%>" method="GET">
                        <div class="boxstatus">
                            <textarea name="chatview" cols="76" rows="19" readonly>Selamat datang di Man-IRC: Man in Real Chat :*</textarea>
                        </div>
                        <div class="boxinput">
                            <input class="inputbox" type="text" name="perintah">
                            <button class="enterbutton" type="submit" name="Enter"> Enter </button>
                        </div>
                    </form>
                </div>

                <div class="tabbertab">
                    <h2>Friend</h2>
                    <form name="" action="" method="">
                        <div class="boxstatus">
                            <textarea name="chatview" cols="76" rows="19" readonly>Silahkan chat dengan friend Anda :*</textarea>
                        </div>
                        <div class="boxinput">
                            <input class="inputbox" type="text" name="inputbox">
                            <button class="enterbutton" type="submit" name="Enter"> Enter </button>
                        </div>
                    </form>
                </div>

                <div class="tabbertab">
                    <h2>Category</h2>
                    <form name="" action="" method="">
                        <div class="boxstatus">
                            <textarea name="chatview" cols="76" rows="19" readonly>Silahkan chat di room ini :*</textarea>
                        </div>
                        <div class="boxinput">
                            <input class="inputbox" type="text" name="inputbox">
                            <button class="enterbutton" type="submit" name="Enter"> Enter </button>
                        </div>
                    </form>
                </div>

            </div>
            <div class="contentkanan tabber">
                <div class="tabbertab">
                    <h2>Friends</h2>
                    <div class="boxfriendcategory scrollver">
                        <%
                            for(int i=0; i<friend.size(); ++i ) {
                                out.print("<div class='heightlist'><a href=\"javascript:var a = createXMLHttpRequestObject(); sendGetRequestToServerAndResponse(a,'tabber/tabberfriend.jsp','tabberfriend', false);\" class='nounderline' id='nounderline'>- "+friend.get(i).getFriendTo()+"</a></div>");
                            }
                        %>
                    </div>
                </div>
                <div class="tabbertab">
                    <h2>Categories</h2>
                    <div class="boxfriendcategory  scrollver">
                        <%
                            for(int i=0; i<categories.size(); ++i ) {
                                if(categories.get(i).getParent().equals("null")){
                                    out.print("<div class='heightlist'><a href='' class='nounderline' id='nounderline'>- Kategori "+categories.get(i).getName()+"</a></div>");
                                    for(int j=0; j<categories.size(); ++j ) {
                                        if(categories.get(j).getParent().equals(categories.get(i).getName())){
                                            out.print("<div class='heightlist'><a href='' class='nounderline' id='nounderline'>|    - Sub Kategori "+categories.get(j).getName()+"</a></div>");
                                        }
                                    }
                                }
                                    
                            }
                        %>
                    </div>
                    
                </div>
                <%--
                <div>
                    tab
                </div>
                <div class="boxfriendcategory">
                    <div>
                        <label>ini box friend</label>
                    </div>
                    <div>
                        <label>ini box category juga</label>
                    </div>
                </div>
                --%>
            </div>
        </div>
       <%@ include file="layout/footerhome.jsp" %>
    </body>
</html>
